<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:template name="PreserveLineBreaks">
    <xsl:param name="text"/>
    <xsl:choose>
        <xsl:when test="contains($text,'&#xA;')">
            <xsl:value-of select="substring-before($text,'&#xA;')"/>
            <br/>
            <xsl:call-template name="PreserveLineBreaks">
                <xsl:with-param name="text">
				  <xsl:if test="$mjb.internet.plugin!='com.moviejukebox.plugin.SratimPlugin'">
					<xsl:value-of select="substring-after($text,'&#xA;')"/>
				  </xsl:if>
				  <xsl:if test="$mjb.internet.plugin='com.moviejukebox.plugin.SratimPlugin'">
					<xsl:value-of disable-output-escaping="yes" select='translate(substring-after($text,"&#xA;"),"{}","&lt;&gt;")' />
				  </xsl:if>
                </xsl:with-param>
            </xsl:call-template>
        </xsl:when>
		<xsl:when test="string-length($text)&lt;440"><!-- plot length -->
				  <xsl:if test="$mjb.internet.plugin!='com.moviejukebox.plugin.SratimPlugin'">
					<xsl:value-of select="$text"/>
				  </xsl:if>
				  <xsl:if test="$mjb.internet.plugin='com.moviejukebox.plugin.SratimPlugin'">
					<xsl:value-of disable-output-escaping="yes" select='translate($text,"{}","&lt;&gt;")'/>
				  </xsl:if>
		</xsl:when>
        <xsl:otherwise>
				  <xsl:if test="$mjb.internet.plugin!='com.moviejukebox.plugin.SratimPlugin'">
					<xsl:value-of select="substring($text,1,436)"/>...<!-- plot length minus 4 -->
				  </xsl:if>
				  <xsl:if test="$mjb.internet.plugin='com.moviejukebox.plugin.SratimPlugin'">
					<xsl:value-of disable-output-escaping="yes" select='translate(substring($text,1,436),"{}","&lt;&gt;")'/>...<!-- plotlen -4 -->
				  </xsl:if>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="language">
	<xsl:if test="language='Chinese'">CHI</xsl:if>
	<xsl:if test="language='Danish'">DAN</xsl:if>
	<xsl:if test="language='Dual Language' or string-length(language)-string-length(translate(language,'/',''))=1">DL</xsl:if>
	<xsl:if test="language='English'">ENG</xsl:if>
	<xsl:if test="language='French'">FRA</xsl:if>
	<xsl:if test="language='German'">GER</xsl:if>
	<xsl:if test="language='Hebrew'">HEB</xsl:if>
	<xsl:if test="language='Hindi'">HIN</xsl:if>
	<xsl:if test="language='Hungarian'">HUN</xsl:if>
	<xsl:if test="language='Italian'">ITA</xsl:if>
	<xsl:if test="language='Japanese'">JPN</xsl:if>
	<xsl:if test="language='Norwegian'">NOR</xsl:if>
	<xsl:if test="language='Polish'">POL</xsl:if>
	<xsl:if test="language='Portuguese'">POR</xsl:if>
	<xsl:if test="language='Russian'">RUS</xsl:if>
	<xsl:if test="language='Spanish'">SPA</xsl:if>
	<xsl:if test="language='Swedish'">SWE</xsl:if>
	<xsl:if test="language='Thai'">THA</xsl:if>
	<xsl:if test="language='VO'">VO</xsl:if>
	<xsl:if test="string-length(language)-string-length(translate(language,'/',''))&gt;1">
		<xsl:value-of select="string-length(language)-string-length(translate(language,'/',''))+1"/>
	</xsl:if>
</xsl:template>

<xsl:template name="rating">
	<xsl:choose>
		<xsl:when test="rating='0' or rating='10' or rating='20' or rating='30' or rating='40' or rating='50' or rating='60' or rating='70' or rating='80' or rating='90'">
			<xsl:value-of select="concat(rating div 10,'.00')" />
		</xsl:when>
		<xsl:when test="rating='100'">10.0</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="concat(rating div 10,'0')" />
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template name="videoOutput">
<xsl:choose>
	<xsl:when test="contains(videoOutput,'720p')">720</xsl:when>
	<xsl:when test="contains(videoOutput,'1080')">1080</xsl:when>
	<xsl:when test="contains(videoOutput,'NTSC') or contains(videoOutput,'24p')">NTSC</xsl:when>
	<xsl:when test="contains(videoOutput,'PAL')">PAL</xsl:when>
	<xsl:when test="contains(videoOutput,'480')">480</xsl:when>
	<xsl:when test="contains(videoOutput,'576')">576</xsl:when>
	<xsl:when test="contains(videoOutput,'SDTV')">SDTV</xsl:when>
	<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="videoCodec"><!-- width=65 height=26 -->
<xsl:choose>
	<xsl:when test="contains(videoCodec,'AVC') or contains(videoCodec,'avc1') or contains(videoCodec,'264')"><img src="pictures/flags/codec_h264.png"/></xsl:when>
	<xsl:when test="contains(videoCodec,'XviD')"><img src="pictures/flags/codec_xvid.png"/></xsl:when>
	<xsl:when test="contains(videoCodec,'DivX')"><img src="pictures/flags/codec_divx.png"/></xsl:when>
	<xsl:when test="contains(videoCodec,'MPEG')"><img src="pictures/flags/codec_mpeg.png"/></xsl:when>
	<xsl:when test="contains(videoCodec,'icrosoft') or contains(videoCodec,'MICROSOFT') or contains(videoCodec,'VC-1')"><img src="pictures/flags/codec_ms.png"/></xsl:when>
	<xsl:otherwise><img src="pictures/flags/video_unknown.png"/></xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="videoSource">
<xsl:choose>
	<xsl:when test="contains(videoSource,'DVDSCR')"><img src="pictures/flags/source_dvdscr.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'R5')"><img src="pictures/flags/source_r5.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'BluRay')"><img src="pictures/flags/source_bluray.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'HDDVD')"><img src="pictures/flags/source_hddvd.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'DVD')"><img src="pictures/flags/source_dvd.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'HDTV')"><img src="pictures/flags/source_hdtv.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'UNKNOWN')"><img src="pictures/flags/unknownvideo.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'CAM')"><img src="pictures/flags/source_cam.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'TS')"><img src="pictures/flags/source_telecine.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'D-THEATER')"><img src="pictures/flags/source_dtheater.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'WEBDL')"><img src="pictures/flags/source_webdl.png"/></xsl:when>
	<xsl:when test="contains(videoSource,'SDTV')"><img src="pictures/flags/source_sdtv.png"/></xsl:when>
	<xsl:otherwise><img src="pictures/flags/video_unknown.png"/></xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="audioCodec"><!-- 60x26 -->
<xsl:variable name="parsedAudioCodec" select="tokenize(//details/movie/audioCodec,' / ')"/>           
<xsl:variable name="parsedAudioChannels" select="tokenize(//details/movie/audioChannels,' / ')"/>
<xsl:variable name="pass" select="position()"/>

<td width="62" align="center">

<xsl:choose>
	<xsl:when test="contains($parsedAudioCodec[$pass],'AC3')"><img src="pictures/flags/audcod_dolby.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'TrueHD')"><img src="pictures/flags/audcod_truehd.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'DTS-HD')"><img src="pictures/flags/audcod_dtshd.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'DTS')"><img src="pictures/flags/audcod_dts.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'MP3')"><img src="pictures/flags/audcod_mp3.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'AAC')"><img src="pictures/flags/audcod_aac.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'VORBIS') or contains($parsedAudioCodec[$pass],'orbis')"><img src="pictures/flags/audcod_ogg.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'A_FLAC')"><img src="pictures/flags/flags/audcod_flac.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'MICROSOFT') or contains($parsedAudioCodec[$pass],'icrosoft') or contains($parsedAudioCodec[$pass],'162') or contains($parsedAudioCodec[$pass],'VC-1')"><img src="pictures/flags/audcod_ms.png"/></xsl:when>
	<xsl:when test="contains($parsedAudioCodec[$pass],'PCM')"><img src="pictures/flags/audcod_pcm.png"/></xsl:when>
	<xsl:otherwise><img src="pictures/flags/audcod_unknown.png"/></xsl:otherwise>
</xsl:choose>

</td><td width="31" align="center" class="smallinfo bold flagtext">

<xsl:if test="audioChannels!='UNKNOWN'">
	<xsl:choose>
		<xsl:when test="$parsedAudioChannels[$pass]=2">2.0</xsl:when>
		<xsl:when test="$parsedAudioChannels[$pass]=3">2.1</xsl:when>
		<xsl:when test="$parsedAudioChannels[$pass]=6">5.1</xsl:when>
		<xsl:when test="$parsedAudioChannels[$pass]=7">6.1</xsl:when>
		<xsl:when test="$parsedAudioChannels[$pass]=8">7.1</xsl:when>
		<xsl:otherwise><xsl:value-of select="concat($parsedAudioChannels[$pass],'.0')"/></xsl:otherwise>
	</xsl:choose>
</xsl:if>
<xsl:if test="audioChannels='UNKNOWN'">?</xsl:if>

</td>

</xsl:template>

<xsl:template name="flags">
<table border="0" cellpadding="0" cellspacing="0">
	<tr>
		<xsl:if test="libraryDescription!='UNKNOWN'"><!-- library -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30"/></tr>
					<tr>
						<td height="32" width="42" background="pictures/flags/frame_library-icon.png"/>
						<td background="pictures/flags/frame_center.png" class="info bold flagtext2">
							<xsl:choose>
								<xsl:when test="string-length(libraryDescription)&lt;26">
									<xsl:value-of select="libraryDescription"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="substring(libraryDescription,1,22)"/>...
								</xsl:otherwise>
							</xsl:choose>
						</td>
						<td width="5" background="pictures/flags/frame_right.png"/>
					</tr>
				</table>
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:if test="count(files/file)!=1 and season=-1"><!-- multipart for movies only -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30"/></tr>
					<tr>
						<td height="32" width="93" align="right" background="pictures/flags/frame_multipart.png">
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="39"/>
									<td width="52" align="center" class="info bold flagtext2">
										<xsl:value-of select="count(files/file)"/>
									</td>
									<td width="2"/>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:if test="contains(subtitles,'YES')"><!-- subtitles -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30"/></tr>
					<tr>
						<td height="32" width="58">
							<img src="pictures/flags/subtitles.png"/>
						</td>
					</tr>
				</table>						
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:if test="language='Chinese' or language='Danish' or language='Dual Language' or string-length(language)-string-length(translate(language,'/',''))=1 or language='English' or language='French' or language='German' or language='Hebrew' or language='Hindi' or language='Hungarian' or language='Italian' or language='Japanese' or language='Norwegian' or language='Polish' or language='Portuguese' or language='Russian' or language='Spanish' or language='Swedish' or language='Thai' or language='VO' or string-length(language)-string-length(translate(language,'/',''))&gt;1"><!-- language flag -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30"/></tr>
					<tr>
						<td height="32" width="85" align="right" background="pictures/flags/frame_lang.png">
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30"/>
									<td width="53" align="center" class="info bold flagtext2">
										<xsl:call-template name="language"/>
									</td>
									<td width="2"/>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:if test="year!='UNKNOWN' and season!=-1"><!-- year for TV shows -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30"/></tr>
					<tr><td height="32" width="64" align="center" background="pictures/flags/frame_year.png" class="info bold flagtext2"><xsl:value-of select="year"/></td></tr>
				</table>
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:if test="rating!='UNKNOWN'"><!-- rating flag -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30"/></tr>
					<tr><td height="32" width="82" align="right" background="pictures/flags/frame_imdb.png" class="info bold flagtext2"><xsl:call-template name="rating"/><xsl:text>&#160;</xsl:text></td></tr>
				</table>
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:choose><!-- videoOutput/videoCodec or videoSource/aspect flag -->
			<xsl:when test="videoOutput='UNKNOWN' and videoCodec='UNKNOWN' and videoSource='UNKNOWN' and aspect='UNKNOWN'"></xsl:when>
			<xsl:otherwise>
				<td>
					<table border="0" cellpadding="0" cellspacing="0">
						<tr><td height="30" colspan="3"/></tr>
						<tr>
							<td height="32" background="pictures/flags/frame_aspect.png">
								<table border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="50" align="center" class="smallinfo bold flagtext">
											<xsl:call-template name="videoOutput"/>
										</td>
										<td width="67" align="center">
											<xsl:if test="$VideoSourceOrCodecOrPriority='Source'">
												<xsl:call-template name="videoSource"/>
											</xsl:if>
											<xsl:if test="$VideoSourceOrCodecOrPriority='Codec'">
												<xsl:call-template name="videoCodec"/>
											</xsl:if>
											<xsl:if test="$VideoSourceOrCodecOrPriority='Priority'">
												<xsl:if test="videoSource!='UNKNOWN'">
													<xsl:call-template name="videoSource"/>
												</xsl:if>
												<xsl:if test="videoSource='UNKNOWN'">
													<xsl:call-template name="videoCodec"/>
												</xsl:if>
											</xsl:if>
										</td>
										<td width="43" align="center" class="smallinfo bold flagtext">
											<xsl:if test="not(contains(aspect,'UNKNOWN'))">
												<xsl:value-of select="substring(substring-before(aspect,':'),1,4)"/>
											</xsl:if>
											<xsl:if test="contains(aspect,'UNKNOWN')">?</xsl:if>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
				<td width="16"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:if test="count(tokenize(//details/movie/audioCodec,' / ')) != 0"><!-- audioCodec flag -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr><td height="30" colspan="3"/></tr>
					<tr>
						<td height="32" background="pictures/flags/frame_audio.png">
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="2"/>
									<xsl:call-template name="audioCodec"/>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
			<td width="16"/>
		</xsl:if>
		<xsl:if test="$StudioLogos='true'"><!-- studio flag -->
			<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td width="92" height="62" align="center" valign="middle" background="pictures/flags/frame_studio.png">
							<img>
								<xsl:attribute name="src">pictures/studios/<xsl:value-of select="company"/>.png</xsl:attribute>
								<xsl:attribute name="width">86</xsl:attribute>
							</img>
						</td>
					</tr>
				</table>
			</td>
		</xsl:if>
	</tr>
</table>
</xsl:template>

<xsl:template name="trailer">
	<a>
		<xsl:attribute name="href">
			<xsl:value-of select="//movie/extras/extra[translate(substring(@title,1,7),'TRAILER','trailer')='trailer']"/>
		</xsl:attribute>
		<xsl:attribute name="tvid">info</xsl:attribute>
		<xsl:call-template name="zcd"><xsl:with-param name="url" select="."/></xsl:call-template>
		<xsl:if test="//movie/prebuf != '-1'"><xsl:attribute name="prebuf"><xsl:value-of select="//movie/prebuf" /></xsl:attribute></xsl:if>
		<xsl:attribute name="vod"/>
	</a>
</xsl:template>

<xsl:template name="zcd">
	<xsl:param name="url"/>
	<xsl:param name="container"/>
	<xsl:if test="$container = 'ISO' or (substring($url, (string-length($url) - string-length('.ISO')) + 1) = '.ISO') or (substring($url, (string-length($url) - string-length('.iso')) + 1) = '.iso')">
		<xsl:attribute name="zcd">2</xsl:attribute>
	</xsl:if>
	<xsl:if test="$container = 'IMG' or (substring($url, (string-length($url) - string-length('.IMG')) + 1) = '.IMG') or (substring($url, (string-length($url) - string-length('.img')) + 1) = '.img')">
		<xsl:attribute name="zcd">2</xsl:attribute>
	</xsl:if>
	<xsl:if test="substring($url, (string-length($url) - string-length('VIDEO_TS')) + 1) = 'VIDEO_TS' or //movie/container = 'DVD Video' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-7,8) = 'video_ts'">
		<xsl:attribute name="zcd">2</xsl:attribute>
	</xsl:if>
	<xsl:if test="substring($url, (string-length($url) - string-length('/')) + 1) = '/'">
		<xsl:attribute name="zcd">2</xsl:attribute>
	</xsl:if>
</xsl:template>

<xsl:template name="playfile">

<xsl:variable name="rar">
	<xsl:if test="//movie/container = 'RAR' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-3,4) = '.RAR' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-3,4) = '.rar' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-9,10) = 'part01.rar' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-9,10) = 'PART01.RAR' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-10,11) = 'part001.rar' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-10,11) = 'PART001.RAR'">true</xsl:if>
</xsl:variable>

<xsl:variable name="disc">
	<xsl:if test="//movie/container = 'ISO' or (substring(fileURL, (string-length(fileURL) - string-length('.ISO')) + 1) = '.ISO') or (substring(fileURL, (string-length(fileURL) - string-length('.iso')) + 1) = '.iso') or //movie/container = 'IMG' or (substring(fileURL, (string-length(fileURL) - string-length('.IMG')) + 1) = '.IMG') or (substring(fileURL, (string-length(fileURL) - string-length('.img')) + 1) = '.img') or substring(fileURL, (string-length(fileURL) - string-length('VIDEO_TS')) + 1) = 'VIDEO_TS' or //movie/container = 'DVD Video' or substring(//files/file/fileURL,string-length(//files/file/fileURL)-7,8) = 'video_ts' or substring(fileURL, (string-length(fileURL) - string-length('/')) + 1) = '/'">true</xsl:if>
</xsl:variable>

<xsl:choose>
	<xsl:when test="count(files/file) = 1">
		<a>
			<xsl:attribute name="href"><xsl:value-of select="//files/file/fileURL"/><xsl:if test="$rar='true'">?playall=1</xsl:if></xsl:attribute>
			<xsl:choose>
				<xsl:when test="$rar='true'">
					<xsl:attribute name="vod">playlist</xsl:attribute><!--vod=playlist-->
				</xsl:when>
				<xsl:otherwise>
					<xsl:attribute name="vod"/>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:call-template name="zcd">
				<xsl:with-param name="url" select="//files/file/fileURL"/>
				<xsl:with-param name="container" select="//movie/container"/>
			</xsl:call-template>
			<xsl:if test="//movie/prebuf != -1">
				<xsl:attribute name="prebuf"><xsl:value-of select="//movie/prebuf" /></xsl:attribute>
			</xsl:if>
			<xsl:attribute name="onkeydownset">pgdn</xsl:attribute>
			<xsl:attribute name="onkeyupset">pgup</xsl:attribute>
			<xsl:attribute name="onkeyrightset">pgdn</xsl:attribute>
			<xsl:attribute name="onkeyleftset">pgup</xsl:attribute>
			<xsl:attribute name="TVID">Play</xsl:attribute>
			<xsl:attribute name="name">play</xsl:attribute>
			<img src="pictures/1x1.png"/>
		</a>
	</xsl:when>
	<xsl:when test="//movie/container = 'BDAV' or count(files/file) != 1">
		<a>
			<xsl:choose>
				<xsl:when test="$disc='true'">
					<xsl:attribute name="href"><xsl:value-of select="//files/file/fileURL"/></xsl:attribute>
					<xsl:call-template name="zcd">
						<xsl:with-param name="url" select="//files/file/fileURL"/>
						<xsl:with-param name="container" select="//movie/container"/>
					</xsl:call-template>
					<xsl:attribute name="vod"/>
				</xsl:when>
				<xsl:otherwise><!-- bdav and other non-disc formats -->
					<xsl:attribute name="href"><xsl:value-of select="concat(/details/movie/baseFilename,'.playlist.jsp')"/></xsl:attribute>
					<xsl:attribute name="vod">playlist</xsl:attribute>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:attribute name="onkeydownset">pgdn</xsl:attribute>
			<xsl:attribute name="onkeyupset">pgup</xsl:attribute>
			<xsl:attribute name="onkeyrightset">pgdn</xsl:attribute>
			<xsl:attribute name="onkeyleftset">pgup</xsl:attribute>
			<xsl:attribute name="TVID">Play</xsl:attribute>
			<xsl:attribute name="name">play</xsl:attribute>
			<img src="pictures/1x1.png"/>
		</a>
		<xsl:for-each select="files/file"><!-- "1" would work for BDAV -->
		<xsl:sort select="@firstPart" data-type="number" order="ascending"/>
			<a>
				<xsl:attribute name="href"><xsl:value-of select="fileURL"/></xsl:attribute>
				<xsl:attribute name="TVID"><xsl:value-of select="@firstPart"/></xsl:attribute>
				<xsl:call-template name="zcd">
					<xsl:with-param name="url" select="//files/file/fileURL"/>
					<xsl:with-param name="container" select="//movie/container"/>
				</xsl:call-template>
				<xsl:attribute name="vod"/>
				<xsl:if test="//movie/prebuf != -1">
					<xsl:attribute name="prebuf"><xsl:value-of select="//movie/prebuf"/></xsl:attribute>
				</xsl:if>
			</a>
		</xsl:for-each>
	</xsl:when>
</xsl:choose>	
</xsl:template>

<xsl:template name="unfocusedepisodetitles">
	<xsl:choose>
		<xsl:when test="string-length(@title)&lt;60">
			<xsl:value-of select="translate(@title,$lcletters,$ucletters)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="substring(translate(@title,$lcletters,$ucletters),1,56)"/>...
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template name="focusedepisodetitle">
	<xsl:choose>
		<xsl:when test="string-length(@title)&lt;28">
			<xsl:value-of select="translate(@title,$lcletters,$ucletters)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="substring(translate(@title,$lcletters,$ucletters),1,24)"/>...
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template name="navigationalaska">
	<a>
		<xsl:attribute name="TVID">HOME</xsl:attribute>
		<xsl:attribute name="href"><xsl:value-of select="$homePage"/></xsl:attribute>
	</a>
	<xsl:if test="$ParentalControl = 'false'">
		  <a TVID="PGDN" ONFOCUSLOAD="">
			<xsl:attribute name="name">pgdn</xsl:attribute>
			<xsl:attribute name="href">
				<xsl:choose>
					<xsl:when test="contains(next,'UNKNOWN')"><xsl:value-of select="first" />.html</xsl:when>
					<xsl:otherwise><xsl:value-of select="next" />.html</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
		  </a>
		  <a TVID="PGUP" ONFOCUSLOAD="">
			<xsl:attribute name="name">pgup</xsl:attribute>
			<xsl:attribute name="href">
				<xsl:choose>
					<xsl:when test="contains(previous,'UNKNOWN')"><xsl:value-of select="last" />.html</xsl:when>
					<xsl:otherwise><xsl:value-of select="previous" />.html</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
		  </a>
	</xsl:if>
	<xsl:if test="$ParentalControl = 'true'">
		  <a TVID="PGDN" ONFOCUSLOAD="">
			<xsl:attribute name="name">pgdn</xsl:attribute>
			<xsl:attribute name="href">javascript:history.back();</xsl:attribute>
		  </a>
		  <a TVID="PGUP" ONFOCUSLOAD="">
			<xsl:attribute name="name">pgup</xsl:attribute>
			<xsl:attribute name="href">javascript:history.back();</xsl:attribute>
		  </a>
	</xsl:if>
</xsl:template>

<xsl:template name="shortcuts">
<xsl:if test="$RedURL != ''"><a><xsl:attribute name="TVID">RED</xsl:attribute><xsl:attribute name="href"><xsl:value-of select="$RedURL" /></xsl:attribute></a></xsl:if>
<xsl:if test="$GreenURL != ''"><a><xsl:attribute name="TVID">GREEN</xsl:attribute><xsl:attribute name="href"><xsl:value-of select="$GreenURL" /></xsl:attribute></a></xsl:if>
<xsl:if test="$YellowURL != ''"><a><xsl:attribute name="TVID">YELLOW</xsl:attribute><xsl:attribute name="href"><xsl:value-of select="$YellowURL" /></xsl:attribute></a></xsl:if>
<xsl:if test="$BlueURL != ''"><a><xsl:attribute name="TVID">BLUE</xsl:attribute><xsl:attribute name="href"><xsl:value-of select="$BlueURL" /></xsl:attribute></a></xsl:if>
</xsl:template>

<xsl:variable name="version">1.10.0213</xsl:variable>

</xsl:stylesheet>